//
//  LoginView.m
//  UI_豆瓣
//
//  Created by dllo on 15/10/27.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "LoginView.h"

@interface LoginView ()

@property (nonatomic, retain)UILabel *nameLabel;
@property (nonatomic, retain)UILabel *passwordLabel;


@end

@implementation LoginView

- (void)dealloc
{
    [_logButton release];
    [_registButton release];
    [_nameField release];
    [_passwordField release];
    [_nameLabel release];
    [_passwordLabel release];
    [super dealloc];
}


-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

-(void)createSubView
{
    //用户名
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 150, 55, 40)];
    //    self.nameLabel.backgroundColor = [UIColor yellowColor];
    self.nameLabel.text = @"账号:";
    self.nameLabel.font = [UIFont systemFontOfSize:20];
//    self.nameLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:self.nameLabel];
    [_nameLabel release];
    
    
    //用户名输入
    self.nameField = [[UITextField alloc]initWithFrame:CGRectMake(120, 150, 210, 40)];
    //    self.nameField.backgroundColor = [UIColor redColor];
        self.nameField.borderStyle = 3;
    self.nameField.placeholder = @"请输入账号";
    self.nameField.font = [UIFont systemFontOfSize:20];
    [self addSubview:self.nameField];
    [_nameField release];
    self.nameField.clearButtonMode = UITextFieldViewModeAlways;
    
    //密码
    self.passwordLabel = [[UILabel alloc] initWithFrame:CGRectMake(50, 210, 55, 40)];
    //    self.passwordLabel.backgroundColor = [UIColor redColor];
    self.passwordLabel.font = [UIFont systemFontOfSize:20];
    self.passwordLabel.text = @"密码:";
//    self.passwordLabel.textAlignment = NSTextAlignmentRight;
    [self addSubview:self.passwordLabel];
    [_passwordField release];
    
    
    //密码输入
    self.passwordField = [[UITextField alloc]initWithFrame:CGRectMake(120, 210, 210, 40)];
    //    self.passwordField.backgroundColor = [UIColor yellowColor];
    self.passwordField.borderStyle = 3;
    self.passwordField.placeholder = @"请输入密码";
    self.passwordField.secureTextEntry = YES;
    self.passwordField.font = [UIFont systemFontOfSize:20];
    [self addSubview:self.passwordField];
    [_passwordField release];
    self.passwordField.clearButtonMode = UITextFieldViewModeAlways;

    
    //登录按钮
    self.logButton = [UIButton buttonWithType:UIButtonTypeCustom];
     self.logButton.frame = CGRectMake(30, 300, 140, 40);
    [ self.logButton setBackgroundImage:[UIImage imageNamed:@"denglu.png"] forState:UIControlStateNormal];
    self.logButton.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.logButton];
    self.logButton.layer.masksToBounds = YES;
    self.logButton.layer.cornerRadius = 5;
   
    
    //注册按钮
   self.registButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.registButton.frame = CGRectMake(205, 300, 140, 40);
    [self.registButton setBackgroundImage:[UIImage imageNamed:@"zhuce.png"] forState:UIControlStateNormal];
    self.registButton.backgroundColor = [UIColor yellowColor];
    [self addSubview:self.registButton];
    self.registButton.layer.masksToBounds = YES;
    self.registButton.layer.cornerRadius = 5;
    
    
    
    

}



- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.nameField resignFirstResponder];
    [self.passwordField resignFirstResponder];
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
